﻿using NLog;
using System;

namespace Common
{
    /// <summary>
    /// NLog辅助类
    /// </summary>
    public class LogHelper
    {
        private static Logger Logger = LogManager.GetCurrentClassLogger();

        #region 调试

        public static void Debug(string content)
        {
            Logger.Debug(content);
        }

        public static void Debug(Exception exception)
        {
            Logger.Debug(exception);
        }

        public static void Debug(Exception exception, string content)
        {
            Logger.Debug(exception, content);
        }

        #endregion 调试

        #region 信息

        /// <summary>
        /// 普通级别
        /// </summary>
        /// <param name="content"></param>
        public static void Info(string content)
        {
            Logger.Info(content);
        }

        /// <summary>
        /// 普通级别
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="content"></param>
        public static void Info(Exception exception, string content)
        {
            Logger.Info(exception, content);
        }

        #endregion 信息

        #region 警告

        /// <summary>
        /// 警告级别
        /// </summary>
        /// <param name="content"></param>
        public static void Warn(string content)
        {
            Logger.Warn(content);
        }

        /// <summary>
        /// 警告级别
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="content"></param>
        public static void Warn(Exception exception, string content)
        {
            Logger.Warn(exception, content);
        }

        #endregion 警告

        #region Trace，追踪

        public void Trace(string msg)
        {
            Logger.Trace(msg);
        }

        public void Trace(string msg, Exception err)
        {
            Logger.Trace(err, msg);
        }

        #endregion Trace，追踪

        #region 错误

        /// <summary>
        /// 错误级别
        /// </summary>
        /// <param name="content"></param>
        public static void Error(string content)
        {
            Logger.Error(content);
        }

        /// <summary>
        /// 错误级别
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="content"></param>
        public static void Error(Exception exception)
        {
            Logger.Error(exception);
        }

        /// <summary>
        /// 错误级别
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="content"></param>
        public static void Error(Exception exception, string content)
        {
            Logger.Error(exception, content);
        }

        #endregion 错误

        #region Fatal,致命错误

        public void Fatal(string msg)
        {
            Logger.Fatal(msg);
        }

        public void Fatal(string msg, Exception err)
        {
            Logger.Fatal(err, msg);
        }

        #endregion Fatal,致命错误
    }
}